<?php
// Tim'Roster
// Copyright (c) 2011 Nicolas Nallet <aspgic2@gmail.com>
//
// This file is part of Tim'Roster.
//
// Tim'Roster is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Tim'Roster is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

$xml_config = simplexml_load_file('config.xml');
include_once($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/data_access/item_DA.php');


class Item_Family {

    /**
     * (PHP 5)<br/>
     * Get item family
     * @param int $type_id
     * @return array of Item_Family
     */
    public static function get_family($type_id){
        $item_DA = new item_DA();
        return $item_DA->get_family($type_id);
    }

    /**
     * (PHP 5)<br/>
     * Get item family
     * @param int $family_id
     * @return Item_Family
     */
    public static function get_family_by_id($family_id){
        $item_DA = new item_DA();
        return $item_DA->get_family_by_id($family_id);
    }

    /**
     * (PHP 5)<br/>
     * Construct a Item_Family instance
     * @param int $id
     * @param string $label
     * @param strnig $icon
     */
    public function Item_Family($id, $label, $icon){
        $this->id = $id;
        $this->label = $label;
        $this->icon = $icon;
    }

    private $id;
    /**
     * (PHP 5)<br/>
     * Get the family id
     * @return int
     */
    public function get_id(){
        return $this->id;
    }

    private $label;
    /**
     * (PHP 5)<br/>
     * Get the family label
     * @return string
     */
    public function get_label(){
        return $this->label;
    }

    private $icon;
    /**
     * (PHP 5)<br/>
     * Get the family icon
     * @return string
     */
    public function get_icon(){
        return $this->icon;
    }

}


class Item_Family_Type {
    /**
     * (PHP 5)<br/>
     * Get item family type
     * @return Item_Family_Type
     */
    public static function get_family_type(){
        $item_DA = new item_DA();
        return $item_DA->get_family_type();
    }

    /**
     * (PHP 5)<br/>
     * Get item family type
     * @param int $type_id
     * @return Item_Family_Type
     */
    public static function get_family_type_by_id($type_id){
        $item_DA = new item_DA();
        return $item_DA->get_family_type_by_id($type_id);
    }

    /**
     * (PHP 5)<br/>
     * Construct a Item_Family_Type instance
     * @param int $id
     * @param string $label
     * @param strnig $icon
     */
    public function Item_Family_Type($id, $label, $icon){
        $this->id = $id;
        $this->label = $label;
        $this->icon = $icon;
    }

    private $id;
    /**
     * (PHP 5)<br/>
     * Get the family type id
     * @return int
     */
    public function get_id(){
        return $this->id;
    }

    private $label;
    /**
     * (PHP 5)<br/>
     * Get the family label
     * @return string
     */
    public function get_label(){
        return $this->label;
    }

    private $icon;
    /**
     * (PHP 5)<br/>
     * Get the family icon
     * @return string
     */
    public function get_icon(){
        return $this->icon;
    }
}


class Item_Code{
    /**
     * (PHP 5)<br/>
     * Get item code
     * @param int $family_id
     * @return Item_Code
     */
    public static function get_item_code($family_id){
        $item_DA = new item_DA();
        return $item_DA->get_item_code($family_id);
    }

    /**
     * Get item code
     * @param string $code
     * @return Item_Code
     */
    public static function get_item_code_by_id($code){
        $item_DA = new item_DA();
        return $item_DA->get_item_code_by_id($code);
    }

    /**
     * (PHP 5)<br/>
     * Construct a Item_Code instance
     * @param string $code
     * @param string $label
     */
    public function Item_Code($code, $label){
        $this->code = $code;
        $this->label = $label;
    }

    private $code;
    /**
     * (PHP 5)<br/>
     * Get the family code
     * @return string
     */
    public function get_code(){
        return $this->code;
    }

    private $label;
    /**
     * (PHP 5)<br/>
     * Get the code label
     * @return string
     */
    public function get_label(){
        return $this->label;
    }
}

?>
